package site.hanzhe.did.utils;

/**
 * DidUtil
 *
 * @author 张涵哲
 * @since 2024-06-14 20:40:33
 */
public class DidUtil {

    /**
     * 数字补0
     *
     * @author 张涵哲
     * @since 2024-06-14 20:42:30
     */
    public static String prependZero(int number, int length) {
        String numStr = Integer.toString(number);
        StringBuilder sb = new StringBuilder();
        int zerosToAdd = length - numStr.length();
        for (int i = 0; i < zerosToAdd; i++) {
            sb.append("0");
        }
        sb.append(numStr);
        return sb.toString();
    }

}
